/**
*  \file cancom.c
*
*  \brief
*
*  \author Michael J. Hohmann  <michael.hohmann@linde-mh.de>
*
*
*/

/*===============================================[ private includes  ]================================================*/
#include "cancom.h"
#include "../assertor/assertor.h"
#include "../pal/pal_mem.h"
#include "can_ext_tx.h"


/*===============================================[ private defines   ]================================================*/

/*===============================================[ private datatypes ]================================================*/

/*===============================================[ private variables ]================================================*/

/*===============================================[ private functions ]================================================*/

/*================================================[ inline functions ]================================================*/
/*================================================[ public variables ]================================================*/
F32 const can_resol_rpm              =  1.000f;             /* rpm / dig    =>   1 dig ~ 1 rpm                             */
F32 const can_resol_torque           =  0.100f;             /*  Nm / dig    =>   1 dig ~ 1 dNm      10 dig ~   1 Nm        */
F32 const can_resol_weight           =  1.000f;             /*  kg / dig    =>   1 dig ~ 1 kg                              */
F32 const can_resol_force            =  1.000f;             /*   N / dig    =>   1 dig ~ 1 N                               */
F32 const can_resol_accel            =  0.001f;             /* m/s�/ dig    =>   1 dig ~ 1 mm/s�  1000 dig ~   1 m/s�      */
F32 const can_resol_speed            =  0.001f/3.6f;        /* m/s / dig    =>   1 dig ~ 1 m/h    3600 dig ~   1 m/s       */
F32 const can_resol_ratio            =  0.001f;             /*   1 / dig    =>   1 dig ~ 1 d%     1000 dig ~   1 = 100 %   */
F32 const can_resol_charge           =  0.010f;             /*   1 / dig    =>   1 dig ~ 1 %                               */
F32 const can_resol_angle            =  0.100f/360.f*ZPI;   /*  rd / dig    =>  10 dig ~ 1 �      3600 dig ~ 2pi rd        */
F32 const can_resol_pressure         =  0.100f;             /* bar / dig    =>   1 dig ~ 1 dbar     10 dig ~   1 bar       */
F32 const can_resol_frequency        =  1.000f;             /*  Hz / dig    =>   1 dig ~ 1 Hz                              */
F32 const can_resol_voltage_sensor   =  0.001f;             /*   V / dig    =>   1 dig ~ 1 mV     1000 dig ~   1 V         */
F32 const can_resol_voltage_drive    =  0.010f;             /*   V / dig    =>   1 dig ~ 1 cV      100 dig ~   1 V         */
F32 const can_resol_current_drive    =  1.000f;             /*   A / dig    =>   1 dig ~ 1 A                               */
F32 const can_resol_current_sensor   =  0.001f;             /*   A / dig    =>   1 dig ~ 1 mA     1000 dig ~   1 A         */
F32 const can_resol_length           =  0.001f;             /*   m / dig    =>   1 dig ~ 1 mm     1000 dig ~   1 m         */
F32 const can_resol_temper           =  1.000f;             /*  deg / dig    =>   1 dig ~ 1 deg                            */

F32 const can_temper_min             =-40.000f;             /*deg@ 0 dig    */

/*================================================[ public functions ]================================================*/

RC cancom_initialize( void )
{
   pal_memzero( &cancom, sizeof cancom);

   can_ext_tx_initialize();
   can_ext_rx_initialize();

   can_int_tx_initialize();
   can_int_rx_initialize();
   can_li_ion_initialize();



   //can1rx_initialize();
   //can1tx_initialize();

   return RC_SUCCESS;
}






/*===============================================[ private functions ]================================================*/


/***********************************************************************************************************************
*                             Copyright 2018 Linde Material Handling. All rights reserved.                             *
***********************************************************************************************************************/
